﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NMigrate;
using System.Diagnostics;
using System.Reflection;
using System.IO;
using System.Web.Security;
using NMigrate.Versioning;

namespace $safeprojectname$
{
	class Program
	{
		static void Main(string[] args)
		{
			JsonConfiguration<Environment> configuration = new JsonConfiguration<Environment>("../../Environment.conf");
			Migration migration = new Migration();
			migration.Configuration = configuration;
			migration.FileHandlers.Find<ConfigFileHandler>().DefaultAppExePath = "$safeprojectname$.exe";
			migration.FileHandlers.Find<SqlFileHandler>().DefaultConnectionString = configuration.GetValue().Database.FullConnectionString;
			migration.VersionHandler = new FileVersionHandler("Version.txt");
			var result = migration.Migrate("../../Scripts");
			result.ThrowIfError();
		}
	}
}
